package com.example.android.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.android.R;
import com.github.appintro.AppIntro2;
import com.github.appintro.AppIntroFragment;
import com.github.appintro.AppIntroPageTransformerType;

public class IntroActivity extends AppIntro2 {


    @SuppressLint("ResourceAsColor")
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addSlide(AppIntroFragment.createInstance("第一日",
                "登录、注册", R.drawable.p1, R.color.red));
        addSlide(AppIntroFragment.createInstance("第二日",
                "首页、管理员和用户的“我”界面", R.drawable.p2, R.color.volcano));
        addSlide(AppIntroFragment.createInstance("第三日",
                "我的车辆、添加车辆", R.drawable.p3, R.color.orange));
        addSlide(AppIntroFragment.createInstance("第四日",
                "车辆信息、发布租车信息、已发布租车信息", R.drawable.p4, R.color.gold));
        addSlide(AppIntroFragment.createInstance("第五日",
                "管理员审核、审核结果", R.drawable.p5, R.color.yellow));
        addSlide(AppIntroFragment.createInstance("第六日",
                "我的预约、预约车辆", R.drawable.p6, R.color.lime));
        addSlide(AppIntroFragment.createInstance("第七日",
                "车主新订单、确认收车", R.drawable.p7, R.color.green));
        addSlide(AppIntroFragment.createInstance("第八日",
                "预约与结束、关于我们", R.drawable.p8, R.color.cyan));
        setTransformer(new AppIntroPageTransformerType.Parallax(1.0, -1.0, 2.0));
        isColorTransitionsEnabled();
        setProgressIndicator();
        setImmersiveMode();
    }

    @Override
    protected void onSkipPressed(@Nullable Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

    @Override
    protected void onDonePressed(@Nullable Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}
